package com.jiangyg.mall.core.utils.tree;

import java.util.Comparator;

/**
 * 类描述：树形结构排序
 *
 * @author jiangyg
 * @version 2.0
 * @date 2019-12-22
 */
public class TreeSort implements Comparator<Tree> {

    @Override
    public int compare(Tree o1, Tree o2) {
        int sort1 = o1.getSort() == null ? Integer.MIN_VALUE : o1.getSort();
        int sort2 = o2.getSort() == null ? Integer.MIN_VALUE : o2.getSort();
        return Integer.compare(sort1, sort2);
    }

}
